package calcsdk.nw;

import java.util.Iterator;
import java.util.List;

/**
 *
 * @author Develop
 */
public class Patch implements Cloneable {

    private int from;
    private int to;

    public Patch(int from, int to) {
        this.from = from;
        this.to = to;
    }

    public int getFrom() {
        return from;
    }

    public void setFrom(int from) {
        this.from = from;
    }

    public int getTo() {
        return to;
    }

    public void setTo(int to) {
        this.to = to;
    }
    
    
    public static Patch[] copy(List<Patch> arr) {
        Patch ret[]=new Patch[arr.size()];
        int i=0;
        for (Iterator<Patch> it = arr.iterator(); it.hasNext();) {
            Patch cur = it.next();
            ret[i]=new Patch(cur.from, cur.to);
            i++;
        }
        return ret;
    }
    
    public static boolean isEqual(List<Patch> arrList, Patch[] arr) {
        int i=0;
        for (Iterator<Patch> it = arrList.iterator(); it.hasNext();) {
            Patch cur = it.next();
            if (cur.from!=arr[i].from || cur.to!=arr[i].to) return false;
            i++;
        }
        return true;
    }
}